package com.itheima.dao;

import com.itheima.pojo.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;



import java.util.List;

public interface BookDao {
    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    public int save(Book book);  //返回值表示影响的行数  增加

    @Update("update tbl_book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    public int update(Book book);//修改

    @Delete("delete from tbl_book where id=#{id}")
    public int delete(Integer id);//删除

    @Select("select * from tbl_book where id=#{id}")
    public Book getById(Integer id);//id查询

    @Select("select * from tbl_book")
    public List<Book> getAll();//查询所有
}
